package com.itheima.inetaddress;

import java.io.IOException;
import java.net.*;
import java.util.Scanner;

public class Demo04 {
    public static void main(String[] args) throws IOException {
        //创建码头
        DatagramSocket ds = new DatagramSocket();
        while (true) {
            //创建箱子
            Scanner sc = new Scanner(System.in);
            String s = sc.nextLine();
            if ("886".equals(s)){
                break;
            }
            byte[] bytes = s.getBytes();
            InetAddress inetAddress = InetAddress.getByName("徐谱盛");
            int port = 1000;
            DatagramPacket datagramPacket = new DatagramPacket(bytes,bytes.length,inetAddress,port);
            //发送数据
            ds.send(datagramPacket);
        }
        //释放资源
        ds.close();
    }
}
